﻿using System;
using System.Linq;

namespace Dino
{
    /// <summary>
    /// Represnts a single context for entities
    /// </summary>
    public interface IObjectContext : IDisposable
    {
        /// <summary>
        /// Commits the changes for this context
        /// </summary>
        void Commit();

        /// <summary>
        /// Queries the underlying context by type
        /// </summary>
        IQueryable<T> Query<T>() where T : class;

        /// <summary>
        /// Adds the specified entity to the context
        /// </summary>
        /// <param name="entity">The instance to add</param>
        void Add<T>(T entity) where T : class;

        /// <summary>
        /// Removes the specified entity from the context
        /// </summary>
        /// <param name="entity">The instance to remove</param>
        void Delete<T>(T entity) where T : class;
    }
}